Skip to content

feat(renovate): track the RigelBuild/devenv fork in both devenv locks (RIG-2815) - #865

Merged
trunk-io[bot] merged 3 commits into
mainfrom
dependencies/rig-2815-devenv-lockfile-maintenance
Sep 5, 2026
Merged

feat(renovate): track the RigelBuild/devenv fork in both devenv locks (RIG-2815)#865
trunk-io[bot] merged 3 commits into
mainfrom
dependencies/rig-2815-devenv-lockfile-maintenance

Conversation

@rigel-mintaka

Copy link
Copy Markdown
Contributor

Compass carries two independent devenv scopes — the root dev shell
(devenv.lock) and the agent base image (agent-image/devenv.lock) — and both
resolve the shared canonical fork github:RigelBuild/devenv at its default
branch. Nothing tracked either pin, so both drifted months behind the fork's
main until someone relocked by hand. This wires Renovate to keep both current
on a daily schedule (RIG-2546 T7).

Mechanism

A custom.regex manager surfaces each lock's fork rev as a git-refs digest, and
a coupled packageRule opens a solo branch that runs a postUpgradeTask to relock
the file with devenv update devenv. One manager + one rule + one branch per lock
(RD-1 unifies the source but does not reconcile the two locks, so they stay on
independent cadences).

Why not lockFileMaintenance

The obvious mechanism is unimplementable here, source-verified against the pinned
renovate@44.46.2:

  • lockFileMaintenance is manager-scoped (flatten.ts gates on
    manager.supportsLockFileMaintenance); custom.regex exports neither that flag
    nor updateArtifacts (modules/manager/custom/regex/index.ts), so it is
    silently ignored — no branch, no error, no PR.
  • The native nix manager supports maintenance but only over
    lockFileNames = ['flake.lock'] (modules/manager/nix/index.ts), never
    devenv.lock.
  • postUpgradeTasks are filtered off lockFileMaintenance branches entirely
    (workers/repository/update/branch/execute-post-upgrade-commands.ts:387-400), so
    even a maintenance-capable manager could not carry the relock.

A normal digest upgrade does carry postUpgradeTasks, which is exactly what the
regex-digest + task pairing buys — the same mechanism the devenv-nixpkgs channel
lockstep (refresh-devenv-nixpkgs.ts) already relies on. The manager and rule
comments carry this argument in full, prefixed DO NOT SIMPLIFY.

Verification

  • moon run renovate:typecheck renovate:test green — 148 pass / 0 fail (+26 new
    tests across the guard core, its orchestration harness, and the config coupling).
  • Live renovate@44.46.2 --dry-run=extract against the working tree: both managers
    fire — RigelBuild/devenv extracts the root lock's rev, RigelBuild/devenv-agent-image
    the agent-image lock's, both as git-refs digests. The agent-image lock is behind
    the fork HEAD, so a relock PR would open now; the root lock is coincidentally current.
  • The relock script's wrong-directory guard was red-checked (.cwd(cwd).cwd(".")
    turns the agent-image orchestration test red).

Spec-impact: none. Refs RIG-2815.

Co-authored-by: Matt Wilkinson matt@rigel.build

@linear-code

linear-code Bot commented Sep 4, 2026

Copy link
Copy Markdown

RIG-2815

@trunk-io

trunk-io Bot commented Sep 4, 2026

Copy link
Copy Markdown

😎 Merged successfully - details.

@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown

Compass engineering docs preview: https://dependencies-rig-2815-devenv.compass-eng-docs.pages.dev

Deployed from dependencies/rig-2815-devenv-lockfile-maintenance at ec367d6.

rigel-mintaka and others added 3 commits September 4, 2026 18:02
… (RIG-2815)

Compass carries two independent devenv scopes — the root dev shell
(`devenv.lock`) and the agent base image (`agent-image/devenv.lock`) — and both
resolve the shared canonical fork `github:RigelBuild/devenv` at its default
branch. Nothing tracked either pin, so both drifted months behind the fork's
`main` until someone relocked by hand. This wires Renovate to keep both current
on a daily schedule (RIG-2546 T7).

### Mechanism

A `custom.regex` manager surfaces each lock's fork rev as a `git-refs` digest, and
a coupled packageRule opens a solo branch that runs a `postUpgradeTask` to relock
the file with `devenv update devenv`. One manager + one rule + one branch per lock
(RD-1 unifies the source but does not reconcile the two locks, so they stay on
independent cadences).

### Why not `lockFileMaintenance`

The obvious mechanism is unimplementable here, source-verified against the pinned
`renovate@44.46.2`:

- `lockFileMaintenance` is manager-scoped (`flatten.ts` gates on
  `manager.supportsLockFileMaintenance`); `custom.regex` exports neither that flag
  nor `updateArtifacts` (`modules/manager/custom/regex/index.ts`), so it is
  silently ignored — no branch, no error, no PR.
- The native `nix` manager supports maintenance but only over
  `lockFileNames = ['flake.lock']` (`modules/manager/nix/index.ts`), never
  `devenv.lock`.
- `postUpgradeTasks` are filtered off `lockFileMaintenance` branches entirely
  (`workers/repository/update/branch/execute-post-upgrade-commands.ts:387-400`), so
  even a maintenance-capable manager could not carry the relock.

A normal digest upgrade *does* carry `postUpgradeTasks`, which is exactly what the
regex-digest + task pairing buys — the same mechanism the devenv-nixpkgs channel
lockstep (`refresh-devenv-nixpkgs.ts`) already relies on. The manager and rule
comments carry this argument in full, prefixed DO NOT SIMPLIFY.

### Verification

- `moon run renovate:typecheck renovate:test` green — 148 pass / 0 fail (+26 new
  tests across the guard core, its orchestration harness, and the config coupling).
- Live `renovate@44.46.2 --dry-run=extract` against the working tree: both managers
  fire — `RigelBuild/devenv` extracts the root lock's rev, `RigelBuild/devenv-agent-image`
  the agent-image lock's, both as `git-refs` digests. The agent-image lock is behind
  the fork HEAD, so a relock PR would open now; the root lock is coincidentally current.
- The relock script's wrong-directory guard was red-checked (`.cwd(cwd)` → `.cwd(".")`
  turns the agent-image orchestration test red).

Spec-impact: none. Refs RIG-2815.

Co-authored-by: Matt Wilkinson <matt@rigel.build>
… + accurate fail-loud (RIG-2815)

Round-1 review of PR #865 returned 2 high + 4 medium + 4 low. This additive
commit dispositions them; the structural H1 gap is filed as RIG-3253.

H2 (high) — the agent-image relock ran under the ROOT lock's devenv CLI
(renovate.yml provisions one PATH devenv from devenv.lock). refresh-devenv-lock.ts
now self-provisions the scope-correct devenv: `const src = flakeref(devenvSource(before))`
then `nix run ${src} -- update devenv` in the scope dir, reusing devenvSource/flakeref
from tools/toolchain/devenv-cli/core.ts (mirrors ci.yml:2058-2059). Each lock is now
written by the devenv version IT pins — the two revs differ by design (RD-1).

H1 (high) — the "fail-loud refuses to ship" comments/messages overclaimed. Verified
against renovate@44.46.2: a non-zero postUpgradeTask exit does NOT abort the branch
(execute-post-upgrade-commands.js:112-117 → artifactErrors; branch/index.js:408-417
reaches MANAGER_LOCKFILE_ERROR only in the releaseTimestamp arm, absent for a git-refs
digest; prepareCommit reset --hard re-writes the in-memory rev-bump). Corrected every
comment/message to state the real effect — a red renovate/artifacts status — and that
the fail-closed guarantee is that status + mandatory human review (no automerge). Throws
kept. Making renovate/artifacts a required check / adding a devenv-fork consistency CI
gate is the family-wide structural fix, filed as RIG-3253.

M1 — escape the interior slash in the agent-image managerFilePattern; pin the literal
in config.test.ts. M2 — loud named failure when neither origin/<base> nor <base>
resolves, instead of a raw git diff error; + fallback-direction and unresolvable-base
tests. M3 — nix test stub gates the lock write on the post-`--` args being exactly
`update devenv`; + fail-relock and corrupt-relock sentinel tests. M4 — correct the
minimumReleaseAge:null justification (mechanically inapplicable to a git-refs digest;
compensating control is human review). L1 isolation-chain comment; L2 readonly
DEVENV_LOCK_PATHS; L3 hoist beforeRev out of the log template.

moon run renovate:typecheck renovate:test → 152 pass / 0 fail (4 new tests). Biome
clean on touched files (2 pre-existing config.test.ts warnings, identical on main).
… substituter coupling guard (RIG-2815)

Round-2 review of the R1 fixes (0 high / 2 medium / 3 low) surfaced two
runtime-surface gaps introduced by the R1 relock rework, plus follow-on
review of these fixes (R3) hardened them:

- executionTimeout: 45 (bot-config.json5, globalOnly) so the fork-devenv
  relock — which cold-builds the fork `#devenv` from source, no binary
  cache — is not killed at Renovate's 15-min child-process default, which
  would leave the regex rev bump committed but the lock unrelocked. Comment
  states the knob's GLOBAL scope (raises the hang budget for every manager,
  accepted deliberately) and cites the fork's own ~4.5-min ubuntu-latest
  build. Pinned by a config.test.ts assertion (floor >= 30, mutation-killed
  on removal and on a lowered value).

- Substituter-coupling header note on refresh-devenv-lock.ts + a
  config.test.ts guard that renovate.yml's extra_nix_config still names both
  caches and both trusted keys on LIVE (comment-stripped) config lines, so a
  future trim — including a commented-out or narrated-away block — fails the
  test rather than silently wedging the nightly relock.

- Test hardening: a base-ref direction test where both origin/main and a
  stale local main resolve-and-differ (the prior test passed with the arms
  flipped); a mandatory `--` separator in the nix stub; and a matchStrings
  sync guard across the two fork managers.

Co-authored-by: Matt Wilkinson <matt@rigel.build>
@rigel-mintaka
rigel-mintaka force-pushed the dependencies/rig-2815-devenv-lockfile-maintenance branch from 2c6710f to ec367d6 Compare September 4, 2026 22:04
@rigel-mintaka
rigel-mintaka marked this pull request as ready for review September 4, 2026 22:13
@trunk-io
trunk-io Bot merged commit 40398f7 into main Sep 5, 2026
15 checks passed
@trunk-io
trunk-io Bot deleted the dependencies/rig-2815-devenv-lockfile-maintenance branch September 5, 2026 17:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants